<?php
/**
 *  问题
 *
 */
require_once 'lib/CException.php';
require_once 'services/IdCountService.php';
require_once 'services/QuestionService.php';
require_once 'services/TopicService.php';

class QuestionController extends Controller{

	/**
	 * 单个问题
	 *
	 */
	public function index(){
		$id = intval( parent::getRequest()->getParam('id') );
		$questionService = new QuestionService();

		if(!$id)
			throw new CException("page not found", 404);

		$question = $questionService->getQuestionById( $id );
		if( empty( $question ) ) 
			throw new CException("page not found", 404);

		$this->_output['question'] = $question; 
		$this->render();

	}

}
